<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>文件上传首页</h1>
    <a href="/upload.html">上传文件</a>
    <div v-for="image in arr">
        <h2>{{image.intro}}
            <a href="javascript:void(0)" @click="del(image.id)">删除</a>
        </h2>
        <img :src="image.url" alt="">
    </div>
</div>
<!--引入Vue框架-->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!--引入Axios框架-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            arr:[]
        },
        methods:{
            del(id){
                if (confirm("您确定删除此内容吗?")){
                    axios.get("/delete?id="+id).then(function () {
                        location.reload();
                    })
                }
            }
        },
        created:function () {
            //发请求获取数据
            axios.get("/select").then(function (response) {
                v.arr = response.data;
            })
        }
    })
</script>
</body>
</html>